In [1]:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from pandas import Series, DataFrame
In [2]:
2*(1+3)
Out[2]:
In [3]:
2**10
Out[3]:
In [4]:
_ * 2
Out[4]:
In [5]:
1/2
Out[5]:
In [6]:
1.0/2
Out[6]:
In [7]:
float(1)/2
Out[7]:
In [8]:
np.pi
Out[8]:
In [9]:
np.e
Out[9]:
In [10]:
np.sin(np.pi/4)
Out[10]:
In [11]:
np.sqrt(2)
Out[11]:
In [12]:
np.sqrt([0,1,2,3])
Out[12]:
In [13]:
data_x = [0.0, -0.95, -0.59, 0.59, 0.95]
data_y = [1.0, 0.31, -0.81, -0.81, 0.31]
plt.scatter(data_x,data_y)
Out[13]:
In [14]:
data_x = [0,1,2,3,4,5]
data_y = [0,1,4,9,16,25]
plt.plot(data_x,data_y)
Out[14]:
In [15]:
data_x = np.linspace(0,1,101)
data_y = np.sin(2.0*np.pi*data_x)
plt.plot(data_x,data_y)
Out[15]:
(1) 次の関数のグラフを描いてください。この時、x座標のサンプル数を10, 50, 100として、それぞれのグラフの違いを観察してください。
(2) 次のように各データの座標値 (x,y) のリストが与えられています。このデータの散布図を描いてください。
In [16]:
data = [(0.0,1.0), (-0.95,0.31), (-0.59,-0.81), (0.59,-0.81), (0.95, 0.31)]